home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / e / autobuild.lha / AutoBuild / AutoBuild.doc next >
Encoding:
Text File  |  1994-11-04  |  13.5 KB  |  292 lines

  1.                        *****************************
  2.                        *       Autobuild v1.0      *
  3.                        * © 1994 Jan Hendrik Schulz *
  4.                        *****************************
  5.  
  6.                                Indroduction
  7.                                ~~~~~~~~~~~~
  8.    What is autobuild? Autobuild is an automatic build tool for AmigE. It
  9. can do the same think like the build tool that came with AmigaE v3 if it is
  10. used to build programms which are splitted over several modules, but it
  11. does it automaticly. That meens, you need no .build-file to define the
  12. dependencies etc.
  13.    Additionaly if you use Mac2E you can (must) define the macrofiles that
  14. are needed with a new keyword (MACROS) directly in the source. And you can
  15. define whole macros in the source,too.
  16.  
  17.  
  18.                     Why using autobuild and not build?
  19.                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  20.    If you are writing a big program and splitt the source into several
  21. modules, you have to change the .build-file everytime when you introduce
  22. a new module, or if a source after some changes needs other modules (or
  23. macrofiles, if you use Mac2E).
  24.    With autobuild, if you have changed the MODULE information in the source,
  25. autobuild sees automaticly the new dependence and acts accordingly. And if
  26. you use Mac2E and your source needs another macrofile, it's easier (I think)
  27. to add the name of this macrofile into the source and not into an extra
  28. .build-file.
  29.    Or if you need a (simple) macro only with one source, with autobuild you
  30. can define it directly in this source if you want. You don't have to create
  31. an extra macrofile for it (autobuild does this for you).
  32.    And last but not least, unlike build, autobuild sees circular dependen-
  33. cies between the files. And if you call it with FORCE, every file is still
  34. builded only once!
  35.  
  36.  
  37.                               Requirements
  38.                               ~~~~~~~~~~~~
  39.    To use autobuild you need Kickstart 2.04 or better, AmigaE and maybe
  40. Mac2E if you want to use macros.
  41.  
  42.  
  43.                           How to use autobuild?
  44.                           ~~~~~~~~~~~~~~~~~~~~~
  45.    Autobuild must be called from the shell and it has the following syntax:
  46.  
  47.      TARGET,FORCE=F/S,PRIVATONLY=PO/S,QUIET=Q/S,ECOPTS=EO/K,ECPATH=EP/K,
  48.      MACOPTS=MO/K,MACPATH=MP/K,MACQUIET=MQ/S
  49.  
  50. TARGET      is the name of the file that should be build. (Without the .m
  51.             if it is a module!)
  52.  
  53. FORCE       tells autobuild to build all files, even if they are allready
  54.             uptodate. (Even with FORCE, every file is build only once!)
  55.  
  56. PRIVATONLY  Normaly autobuild compares the filedate of EVERY used module
  57.             and macrofile with the filedate of the target to find out, if
  58.             the target is up to date (newer). If you use PRIVATONLY, only
  59.             the private modules and macrofiles (those which names starting
  60.             with a *) are testet and not those in EMODULES: and EMACROS:
  61.  
  62. QUIET       Only error-messages (and the output of EC and Mac2E) are
  63.             printed.
  64.  
  65. ECOPTS      here you can give additional arguments for the EC-call. You
  66.             should write doublequotes around them! Autobuild calls EC like
  67.             this: EC <file> <ecopts>
  68.             Example: autobuild target ECOPTS "QUIET"
  69.  
  70. ECPATH      You can tell autobuild where to find EC and than autobuild
  71.             copies EC to RAM:EC (if needed) and uses RAM:EC instead of EC.
  72.             Example: autobuild target ECPATH "Work:AmigaE/Bin/EC"
  73.  
  74. MACOPTS     Like ECOPTS but for the Mac2E call. Autobuild calls Mac2E like
  75.             this: Mac2E <source.em> <source.e> <macopts> WITH <macrofiles>
  76.  
  77. MACPATH     Like ECPATH but for Mac2E.
  78.  
  79. MACQUIET    tells autobuild to redirect the output of Mac2E to a temporary
  80.             file (t:mac2eout). This file is only (but automaticly) shown if
  81.             the Mac2E-call wasn't successfull.
  82.  
  83.  
  84.                           The .autobuild file
  85.                           ~~~~~~~~~~~~~~~~~~~
  86.    To make the autobuild call easier, autobuild looks for a file called
  87. ".autobuild" in the currend directory and if it exists, the first line of
  88. this file is passed through ReadArgs() with the template above. So normaly
  89. you can execute autobuild without any arguments. If you use arguments and
  90. additionaly there is a .autobuild-file, both are mixed like this:
  91.  
  92. TARGET, ECOPTS, ECPATH, MACOPTS and MACPATH:
  93.    If you give them with the commandline, the corresponding .autobuild
  94.    setting is ignored.
  95.    
  96. FORCE, PRIVATEONLY, QUIET and MACQUIET:
  97.    The commandline and the .autobuild-settings are Eor()ed.
  98.  
  99.  
  100.                         How does autobuild work?
  101.                         ~~~~~~~~~~~~~~~~~~~~~~~~
  102.    To see, how autobuild works, I think it's the best way to show you how
  103. the most important PROC of autobuild - build() - works. If you call
  104. autobuild e.g. with 'autobuild abc' than main() calls after some initial
  105. work build() with 'abc' as target. And build() works like this:
  106.  
  107.                         *-----------------------*
  108.                         |   PROC build(target)  |
  109.                         *-----------+-----------*
  110.                                     |
  111.                         ?-----------+-----------?
  112.                  +--NO--+ Exists 'target.em' ?  +--YES--+
  113.                  |      ?-----------------------?       |
  114.                  |                                      |
  115.   +--------------+--------------+        +--------------+--------------+
  116.   | Look into 'target.e' to see |        | Look into 'target.em' to see|
  117.   | which emodules are used by  |        | which emodules and which    |
  118.   | this source.                |        | macrofiles are used, and to |
  119.   +--------------+--------------+        | create, if necessary, a tmp.|
  120.                  |                       | macrofile from the macrodefs|
  121.                  |                       | in the source.              |
  122.                  |                       +--------------+--------------+
  123.                  |                                      |
  124.                  |                       ?--------------+--------------?
  125.                  |               +---NO--+     Exists 'target.e' ?     |
  126.                  |               |       ?--------------+--------------?
  127.                  |               |                      | YES
  128.                  |               |       ?--------------+--------------?
  129.                  |               |       |  Is 'target.em' newer than  |
  130.                  |               +--YES--+        'target.e' ?         |
  131.                  |               |       ?--------------+--------------?
  132.                  |               |                      | NO
  133.                  |               |       ?--------------+--------------?
  134.                  |               |       | Is at least one of the used |
  135.                  |               +--YES--+    macrofiles newer than    |
  136.                  |               |       |  'target' (or 'target.m') ? |
  137.                  |                \      ?--------------+--------------?
  138.                  |                 \                    | NO
  139.                  |   +--------------+--------------+    |
  140.                  |   | Call Mac2E to build an up   |    |
  141.                  |   | to date 'target.e'-file     |    |
  142.                  |   +--------------+--------------+    |
  143.                  |                  |                   |
  144.                  +----------------+ | +-----------------+
  145.                                    \|/
  146.                      +--------------+--------------+
  147.                      | Call build() for every used |
  148.                      | privat emodule to make them |
  149.                      | up to date if necessary     |
  150.                      +--------------+--------------+
  151.                                     |
  152.                      ?--------------+--------------?
  153.                      |      Exists 'target'        |
  154.              +---NO--+     (or 'target.m') ?       |
  155.              |       ?--------------+--------------?
  156.              |                      | YES
  157.              |       ?--------------+--------------?
  158.              |       |  Is 'target.e' newer than   |
  159.              +--YES--+ 'target' (or 'target.m') ?  |
  160.              |       ?--------------+--------------?
  161.              |                      | NO
  162.              |       ?--------------+--------------?
  163.              |       | Is at least one of the used |
  164.              +--YES--+ emodules newer than 'target'|
  165.               \      |      (or 'target.m') ?      |
  166.                \     ?--------------+--------------?
  167.                 \                   | NO
  168.    +-------------+-------------+    |
  169.    | Call EC to build an up to |    |
  170.    | date 'target'-file        |    |
  171.    | (or 'target.m'-file )     |    |
  172.    +-------------+-------------+    |
  173.                  |                  |
  174.                  +----------------+ |
  175.                                    \|
  176.                                 *---+---*
  177.                                 |  END  |
  178.                                 *-------*
  179.  
  180.    The above shoud only give an idea what the PROC build() does. The real
  181. PROC build() works a little bit different! It has some lists in memory to
  182. build every file only once, and to look for the filedate of a file only
  183. once for example, but the result is the same.
  184.  
  185.  
  186.                  How to define macrofiles and macros?
  187.                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  188.    First, if you have a source with macros, it's name must end with '.em'!
  189. Autobuild then calls Mac2E to build the '.e'-file. To define which macro-
  190. files should be used, there is the new keyword MACROS. Use this keyword
  191. like the AmigaE keyword MODULE:
  192.    Write MACROS 'abc.pma' to use the macrofile 'EMACROS:abc.pma'. And
  193. write MACROS '*abc.pma' to use the macrofile '<sourcedir>abc.pma'.
  194.  
  195. Example:
  196.  
  197.   MACROS 'abc,pma', '*xyz.pma',  -> You can use a comment here...
  198.        /*  ... or here ... */
  199.          '*macros.ma'            -> ...or here!
  200.  
  201.  
  202.    To define a macro directly in the source, autobuild uses a more E-like
  203. syntax than Mac2E. There are two ways:
  204.  
  205.   MACRO name IS body
  206.  
  207.   MACRO name
  208.   body
  209.   ENDMACRO
  210.  
  211.   To see, how to use this, now some examples on the left side and the Mac2E
  212. version that is builded by autobuild for the Mac2E call on the right side:
  213.                                      |
  214. MACRO test IS 10                     |#define test 10
  215.                                      |
  216. MACRO abc(x,y,z) IS a+b+c -> comment |#define abc(x,y,z) a+b+c
  217.                                      |
  218. MACRO xyz IS /* comment              |#define xyz XYZ
  219.    */   XYZ                          |
  220.                                      |
  221. MACRO blah                           |#define blah\
  222.   first line -> with comment         |first line\
  223.  abc /* comment */ xyz               |abc\
  224.       LAST LINE                      |xyz\
  225.    -> empty line                     |LAST LINE
  226. ENDMACRO                             |
  227.  
  228.  
  229.                           Some important infos!
  230.                           ~~~~~~~~~~~~~~~~~~~~~
  231. -  All the MACRO and MACROS stuff above must be in comments to have no
  232. problems with the E-compiler. Simply put a line with /* before it and a
  233. line with */ behind it. Example:
  234. /*
  235. MACROS 'test.pma'
  236.  
  237. MACRO abc IS xyz
  238. */
  239.  
  240. -  Autobuild reads the source only until it finds the first PROC or EXPORT
  241. keyword to make things faster. BUT: There MUST be at least one of them! If
  242. not, autobuild reads the whole file and then stops with a read error!
  243.  
  244. -  To make autobuild not to complicate, the keywords MODULE, MACRO, MACROS,
  245. PROC and EXPORT must be on the beginning of the line! (No leading spaces or
  246. tabs.) If there are not at the beginning of the line, autobuild doesn't see
  247. them! On the other hand, if you use thees keyword in other situations (e.g.
  248. MODULE after an OPT), make shure that it is NOT at the beginning of the
  249. line to make it invisible for autobuild!
  250.  
  251.  
  252.                           Copyright and Author
  253.                           ~~~~~~~~~~~~~~~~~~~~
  254.          Autobuild is (c) copyright 1994 Jan Hendrik Schulz
  255.  
  256.    Autobuild is giftware, if you use it, send me something usefull (money,
  257. an Amiga 4000 or at least a postcard or an e-mail).
  258.  
  259.    Redistributing autobuild is allowed, as long as all files are included
  260. and unchanged, and as long as no profit (direct or indirect) is made by
  261. distributing autobuild!
  262.  
  263.            My address:   Jan Hendrik Schulz
  264.                          Reinhard-Raffalt-Str. 41
  265.                          94036 Passau
  266.                          Germany
  267.  
  268.              Internet:   schulzj@fmi.uni-passau.de
  269.  
  270.  
  271.                              Disclaimer
  272.                              ~~~~~~~~~~
  273.     THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
  274.  APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
  275.  HOLDER AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
  276.  OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
  277.  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  278.  PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
  279.  PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE
  280.  COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  281.  
  282.     IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  283.  WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY REDISTRIBUTE THE
  284.  PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
  285.  GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
  286.  USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS
  287.  OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR
  288.  THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  289.  PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
  290.  POSSIBILITY OF SUCH DAMAGES.
  291.  
  292.